#pragma	once

#include "ZCommon.h"
#include <boost/scoped_array.hpp>

namespace	Z	{

//------------------------------------------------------------------------------------------------------------------------
class	_ZMainApi	FrameAllocator
{
public:
	typedef	size_t	Marker;

public:
	FrameAllocator(size_t stackkSize = defaultStackSize);
	~FrameAllocator();
	void*	allocateUnaligned(size_t kSize);
	void*	allocateAligned(size_t kSize, size_t alignment);
	Marker	getMarker()	const	{	return mMarker;	}
	void	free(Marker marker = 0)	{	mMarker	= marker;	}

private:
	size_t	mStackSize;
	Marker	mMarker;
	boost::scoped_array<byte_t>	mStack;
	static	const	size_t	defaultStackSize	= 4 * 1024 * 1024;
};

}